package com.pace.gonu.constants;

import com.pace.gonu.model.PlayRock;


/**
 * @author pace
 */
public enum HobakBoardXY {
	r1(25, 25), r2(125, 25), r3(225, 25), r4(125, 75), r5(25, 175), r6(125, 175), r7(225, 175), r8(125, 275), r9(25, 325), r10(125, 325), r11(225, 325);

	private int x;
	private int y;
	HobakBoardXY(int x, int y) {
		this.x = x;
		this.y = y;
	}
	public int getX() {
		return x;
	}
	public int getY() {
		return y;
	}

	public static int getPoint(PlayRock playRock) {
		for(HobakBoardXY boardXY : HobakBoardXY.values()) {
			if (boardXY.getX() == playRock.getPath().getX()) {
				if (boardXY.getY() == playRock.getPath().getY()) {
					return boardXY.ordinal();
				}
			}
		}
		throw new IllegalArgumentException("돌의 위치가 유효하지 않습니다.");
	}
}